import { QiankunFrameAction } from '@lhy-assist/qiankun'
import { PlatformFrameErrorHandler } from './frame-error-handler'
import { PlatformFrameState } from './frame-state'
import { ElMessage } from 'element-plus'

/**
 * 主应用提供给子应用调用的所有方法Action
 *
 * @export
 * @class PlatformFrameAction
 * @extends {QiankunFrameAction<PlatformFrameState>}
 */
export class PlatformFrameAction implements QiankunFrameAction<PlatformFrameState> {
  /**
   * 异常处理
   *
   *
   * @memberOf PlatformFrameAction
   */
  errorHandler = new PlatformFrameErrorHandler()

  /**
   * 路由跳转
   *
   * @param {string} url
   * @param {Record<string, any>} [data]
   *
   * @memberOf PlatformFrameAction
   */
  goRouter(url: string, data?: Record<string, any>): void {
    ElMessage.info('路由跳转: ' + url)
  }

  destroy(): void {}
}
